\pagestyle{myheadings} \setcounter{page}{1} \setcounter{footnote}{0}

\section{~Setting up nested runs} \label{app:nest}
\newcounters 
\vssub
\subsection{~Using {\file ww3\_shel}}
\vssub

The mechanics of running nested models using the single-grid wave model
program {\file ww3\_shel} in principle is simple. A large scale model produces
a file with boundary data, for instance {\file nest1.ww3}. This file is then
renamed to {\file nest.ww3} and put in the directory in which the nested
(small scale) model is run. The small scale model then will automatically
process the file and update the boundary conditions as required and
available. Setting up the nesting consistently is more involved. A simple
step-by-step method is presented here. Another possibility, described in the
next subsection is to assemble the {\file nest.ww3} file from spectral output
using {\code ww3\_bound}.

\newcounter{nestlist}

\begin{list}{\arabic{nestlist})}{\usecounter{nestlist}
             \rightmargin 5mm \labelsep 3mm
             \labelwidth 5mm \leftmargin 10mm}

\item The first step is to set up the large scale model completely, but
      without generating boundary data for the nested model(s). Include the
      proper wind fields, graphical outputs etc. Test this model until you are
      satisfied that it works properly.

\item Set up the small scale model, for the moment ignoring the boundary
      conditions. Take into consideration that the boundary conditions ideally
      should coincide with grid lines in the large scale model to minimize the
      file size of the boundary data files. Set up this model in the same way
      as the large scale model, and test it thoroughly.

\item When the small scale model is set up satisfactorily in the above way,
      the boundary conditions need to be defined. Go into the file {\file
      ww3\_grid.inp} for the small scale model, and mark all the intended
      input boundaries as outlined in the documentation in
      section~\ref{sub:ww3grid}. Make sure that the model switch {\F !/O1} is
      selected in the {\file switch} file, and recompile if necessary. Run
      {\code ww3\_grid} and save the screen output. The output of this program
      now includes a list of all points that are marked as input boundary
      points. Also make sure that stored copies of {\file mod\_def.ww3} for
      the small scale model (if any) are properly updated.

\item The next step is to include all the input boundary points in the above
      list as output boundary points in the large scale model. Keep the list
      handy, and go to the file {\file ww3\_grid.inp} for the large scale
      model. Add all points of the above list as output boundary points as
      indicated in the documentation in section~\ref{sub:ww3grid}. Make sure
      that all data (an no other data) is sent to a single file, and run
      {\code ww3\_grid} with the proper input file. This should now give a
      list of output boundary points that should be consistent with the above
      list of input boundary points. Note that the order in which the points
      occur in the list is inconsequential. Again make sure that stored copies
      of {\file mod\_def.ww3} for the large scale model (if any) are properly
      updated.

\item If there are discrepancies between the two lists of points, iterate
      between the two previous steps until the list are consistent.

\item The next step is to start generating the boundary data from the large
      scale model. This requires the nesting output to be activated in the
      large scale model. The output is already set up and included in the
      model definition file ({\file mod\_def.ww3}) of the large scale model in
      the above steps. It now needs to be activated by setting the beginning
      time, time increment and ending time in the input file {\file
      ww3\_shel.inp} for the actual model run of the large scale model. This
      step does not need to be performed if a second or consecutive nest is
      added. The large scale model will now produce the file with boundary
      data. If this is the first nest included the output file will be {\file
      nest1.ww3}. This file needs to be saved for use in the small scale
      model.

\item To include the nesting data in the small scale model, the above boundary
      data file needs to be renamed to {\file nest.ww3} and needs to be put in
      the directory from which {\file ww3\_shel} for the small scale model is
      run. If the small scale model has properly defined the input boundary
      points in its definition file {\file mod\_def.ww3}, it will
      automatically process the file {\file nest.ww3} and update the boundary
      data as available. At this point, two additional tests are recommended.

\begin{itemize}

\item When first running the small scale model with the file {\file nest.ww3}
      present, pay close attention to the output of {\code ww3\_shel} to
      assure that (i) the program reports that the file {\file nest.ww3} has
      been processed and has been found OK, and (ii) that no additional
      warnings are present regarding incompatible or missing boundary
      data. Also check the log file {\file log.ww3} to assure that the
      boundary data are updated at the expected times.

\item When all data apparently are processed, it is illustrative and prudent to
      make a model run of the small scale model where the wind fields are
      switched off in {\file ww3\_shel.inp}, and where no restart file {\file
      restart.ww3} is made available. In such a model run, wave energy can
      only enter the domain from the boundaries. This is a good test to assure
      that the boundary data is passed from the large scale model to the small
      scale model as expected.

\end{itemize}

\end{list}

\noindent
Additional nested models can be added in the same way. Adding a second level
nest from the small scale model is also done in the same way. The model is
presently set up for producing up to 9 files with boundary data per model
run. There are no limitations on the number of consecutive (`telescoping')
nests.

\vssub
\subsection{~Using {\file ww3\_bound} and/or unstructured grids}
\vssub

In some circumstances it is difficult or impossible to know in advance the
position of the forcing points for small scale model when running the large
scale model. This is the case if one wants to run a coastal zoom using
boundary condition from an on-line or third-party database.

In this case, it is possible to generate {\file nest.ww3} file from spectral
output using {\code ww3\_bound}. This is particularly handy also for
unstructured grids due to the irregular spacing of points on the
boundary. {\code ww3\_bound} takes a list of spectra files, which should have
the same spectral grid, and generates a {\file nest.ww3}. The interpolation
coefficients are determined from the positions of the nearest available
spectra and the positions of the active boundary points in the small scale
model.

\pb
\subsection{~Using {\file ww3\_multi}}
\vssub

Performing two-way nesting in the wave model driver {\file ww3\_multi} is
greatly simplified compared to using the wave model driver {\file ww3\_shel},
because all data transfer needed is performed internally in the multi-grid
wave model routines. A mosaic model system is set up by iteratively going
through the following steps.

\begin{list}{\arabic{nestlist})}{\usecounter{nestlist}
             \rightmargin 5mm \labelsep 3mm
             \labelwidth 5mm \leftmargin 10mm}

\item Set up a grid using the {\file ww3\_grid} utility. Define the grid, its
      active boundary points and all other model information such as time
      steps, but {\it do not} attempt to generate output nesting data for
      other grids. This will be assessed automatically by the multi-grid wave
      model routines in {\file ww3\_multi}. Note that the lowest ranked grid
      can optionally use active boundary data, either as read from file or to
      be kept constant during computation. Higher ranked grids will require
      active boundary point in order to be valid in the mosaic approach,

\item Add this grid as an extra grid to the input file {\file ww3\_multi.inp}
      with the appropriate rank number. Running {\file ww3\_multi} will
      identify discrepancies between grids and requested boundary data points
      that can be resolved iteratively, and other discrepancies between grids.
      It can be tedious to remove such discrepancies by hand. The grid
      generation package of \citet{tol:MMAB07a, tol:OMOD08a} checks for such
      discrepancies automatically, and is therefore recommended for grid
      generation for this version of \ws.

\end{list}

\noindent
Note that grid on which input data fields are defined can be added in a
similar way. Note that the use of land-sea masks in oceanic input fields
(current, water level and ice) is recommended to assure realistic input values
at coastal points.

Generally, lower ranked grids are developed first, although grid of any rank
could be added at any time.

%\bpage \pagestyle{empty}
